//
//  NSDictionary+HLENetWork.m
//  HLENetwork_Example
//
//  Created by hle1879 on 2020/9/29.
//  Copyright © 2020 13434436448@163.com. All rights reserved.
//

#import "NSDictionary+HLENetWork.h"

@implementation NSDictionary (HLENetWork)

-(NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level{
    return [self formatString];
}

- (NSString *)debugDescription{
    return [self formatString];
}

- (NSString*)formatString{
    NSMutableString *dictionaryString = [NSMutableString new];
    [dictionaryString appendString:@"{"];
    [dictionaryString appendString:@"\n"];
    [self enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull vaule, BOOL * _Nonnull stop) {
        [dictionaryString appendFormat:@"\t%@ : ",key];
        [dictionaryString appendFormat:@"%@,",vaule];
        [dictionaryString appendString:@"\n"];
    }];
    [dictionaryString appendString:@"}"];
    
    NSRange range = [dictionaryString rangeOfString:@"," options:NSBackwardsSearch];
    if (range.location != NSNotFound)
        [dictionaryString deleteCharactersInRange:range];
    
    return dictionaryString;
}
@end
